package com.wangzhan.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;


/*
* 目的：Spring boot程序war包部署
* 步骤：①程序入口类需扩展继承SpringBootServletInitializer类
*      ②程序入口类覆盖如下方法：
*       @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
            return builder.sources(WarDemoApplication.class);
        }
*
*      ③更新包为war,在pom.xml中修改<package>war</package>
*      ④配置springboot打包插件(PS:创建项目时有些是会有的):
*         <!--springboot提供给的项目编译打包插件-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
*
*      ⑤在项目中通过Maven Lifecycle install在本地maven仓库安装成一个war包(PS:war包生成的大概路径：D:\IDEA\save_date\war-demo\target
*                                                                                    或者:C:\Users\黑火8\.m2\repository\com\wangzhan\springboot\war-demo\1.0.0)
*      ⑥然后将war包部署到Tomcat下运行：1、把war包复制到Tomcat上(我的Tomcat路径：D:\Tomcat\install-tomcat-9.0.8\webapps)
*                                   2、启动Tomcat(PS:会有war的解压文件)(双击startup.bat启动Tomcat：D:\Tomcat\install-tomcat-9.0.8\bin\startup.bat)
*                                   3、访问(PS:要加上解压文件的名称)(访问路径：http://localhost:8080/war-demo-1.0.0/boot/jsp)
*
*
* */


@SpringBootApplication
public class WarDemoApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(WarDemoApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(WarDemoApplication.class, args);
    }


}
